version 14.1
set more off
set matsize 11000

***************************************************************************************************
* THIS ROUTINE GENERATES TABLE A.XI OF WASEEM (2019) RESTAT
***************************************************************************************************

/* TABLE */

#d				;
matrix 			input table=(0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0);
#d				cr

/* DEFINING TIME VARIABLE */		

use				"$project_data\ExemptionCutoff_06_11.dta",clear
keep			regnor year seinc employee incfrsalary nsale
sort			regnor year
local 			var="seinc"
local			lbound=80000
local			ubound=500000
g				treat=employee==0

/* BINNING DATA */

local 			binsize=20000
local 			nbin=(`ubound'-`lbound')/`binsize'			
local 			mf=`binsize'/1000							
g 				bin=ceil(`var'/`binsize')
replace 		bin=bin*`mf'

/* LOG CHANGE IN EARNINGS */

g 				double z0=`var'
g 				z1=F1.`var'
g 				logchange=log(z1/z0)
keep 			if z0>80000 & z0<=500000
qui				sum logchange,d
drop			if (logchange<r(p1) | logchange>r(p99)) & year<2011
keep			if nsale>0 & nsale<.

/* GENERATING TREATMENT DUMMIES */

g				cutoff=(`var'<=350000 & treat==1)
g				post=year>2008
g				y09=(year==2009)
g				y10=(year==2010)

/* COLUMN (1)-(2) MEDIAN - WITHOUT BASELINE INCOME CONTROL */

preserve
local			i=1
local			j=1
g				xtc=0
forvalues		y=2006/2011 {
qui				sum nsale if year==`y',d
replace			xtc=1 if nsale>r(p50) & year==`y'
}
g				cutoff_09=cutoff*y09
g				cutoff_10=cutoff*y10
g				xtc_post=xtc*post
g				cutoff_xtc=cutoff*xtc
g				cutoff_xtc_09=cutoff*xtc*y09
g				cutoff_xtc_10=cutoff*xtc*y10
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10, cluster(regnor)
matrix			table[13,`j']=e(N)
matrix			table[13,`j'+1]=e(N)
matrix			table[`i',`j']=_b[cutoff_09]
matrix			table[`i'+1,`j']=_se[cutoff_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_10]
matrix			table[`i'+1,`j']=_se[cutoff_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_09]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_10]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc]
matrix			table[`i'+1,`j']=_se[cutoff_xtc]
local			i=`i'+2
matrix			table[`i',`j']=_b[xtc_post]
matrix			table[`i'+1,`j']=_se[xtc_post]
qui				sum logchange if post==0
matrix			table[14,`j']=r(mean)
matrix			table[14,`j'+1]=r(mean)
local			j=`j'+1

g				beta09_b=0
g				beta10_b=0
g				betaxtc09_b=0
g				betaxtc10_b=0
g				se09_b=0
g				se10_b=0
g				sextc09_b=0
g				sextc10_b=0
g				b_cutoff_xtc_b=0
g				se_cutoff_xtc_b=0
g				b_xtc_post_b=0
g				se_xtc_post_b=0
count			if xtc==1 & year==2009 
local			nxtc09=r(N)
count			if xtc==1 & year==2010 
local			nxtc10=r(N)
count			if xtc==1 & (year==2009 | year==2010) 
local			nxtc=r(N)
count			if xtc==0 & year==2009 
local			notxtc09=r(N)
count			if xtc==0 & year==2010 
local			notxtc10=r(N)
qui				count if xtc==1 & cutoff==1
local			ncutoffxtc=r(N)
forvalues		b=100(20)500 {
qui				count if xtc==1 & year==2009 & bin==`b'
local			nxtc09_b=r(N)
qui				count if xtc==1 & year==2010 & bin==`b'
local			nxtc10_b=r(N)
qui				count if xtc==1 & (year==2009 | year==2010) & bin==`b' 
local			nxtc_b=r(N)
qui				count if xtc==0 & year==2009 & bin==`b'
local			notxtc09_b=r(N)
qui				count if xtc==0 & year==2010 & bin==`b'
local			notxtc10_b=r(N)
qui				count if xtc==1 & cutoff==1 & bin==`b'
local			ncutoffxtc_b=r(N)
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10 if bin==`b', cluster(regnor)
replace			beta09_b=_b[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
replace			se09_b=_se[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
local			i=`i'+2
replace			beta10_b=_b[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
replace			se10_b=_se[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
local			i=`i'+2
replace			betaxtc09_b=_b[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
replace			sextc09_b=_se[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
local			i=`i'+2
replace			betaxtc10_b=_b[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
replace			sextc10_b=_se[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
local			i=`i'+2
replace			b_cutoff_xtc_b=_b[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			se_cutoff_xtc_b=_se[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			b_xtc_post_b=_b[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
replace			se_xtc_post_b=_se[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
}
local			i=1
duplicates  	drop bin, force
egen 			beta09=sum(beta09_b)
g				sse09_b=se09_b^2
egen			se09_s=sum(sse09_b)
g				se09=sqrt(se09_s)
egen 			beta10=sum(beta10_b)
g				sse10_b=se10_b^2
egen			se10_s=sum(sse10_b)
g				se10=sqrt(se10_s)
egen			betaxtc09=sum(betaxtc09_b)
g				ssextc09_b=sextc09_b^2
egen			sextc09_s=sum(ssextc09_b)
g				sextc09=sqrt(sextc09_s)
egen			betaxtc10=sum(betaxtc10_b)
g				ssextc10_b=sextc10_b^2
egen			sextc10_s=sum(ssextc10_b)
g				sextc10=sqrt(sextc10_s)
egen 			b_cutoff_xtc=sum(b_cutoff_xtc_b)
g				sse_cutoff_xtc_b=se_cutoff_xtc_b^2
egen			se_cutoff_xtc_s=sum(sse_cutoff_xtc_b)
g				se_cutoff_xtc=sqrt(se_cutoff_xtc_s)
egen			b_xtc_post=sum(b_xtc_post_b)
g				sse_xtc_post_b=se_xtc_post_b^2
egen			se_xtc_post_s=sum(sse_xtc_post_b)
g				se_xtc_post=sqrt(se_xtc_post_s)
qui				sum beta09
matrix			table[`i',`j']=r(mean)
qui				sum se09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum beta10
matrix			table[`i',`j']=r(mean)
qui				sum se10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc09
matrix			table[`i',`j']=r(mean)
qui				sum sextc09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc10
matrix			table[`i',`j']=r(mean)
qui				sum sextc10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_cutoff_xtc
matrix			table[`i',`j']=r(mean)
qui				sum se_cutoff_xtc
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_xtc_post
matrix			table[`i',`j']=r(mean)
qui				sum se_xtc_post
matrix			table[`i'+1,`j']=r(mean)
local 			j=`j'+1
restore

/* COLUMN (3)-(4) TOP QUARTILE - WITHOUT BASELINE INCOME CONTROL */

preserve
local			i=1
g				xtc=0
forvalues		y=2006/2011 {
qui				sum nsale if year==`y',d
replace			xtc=1 if nsale>r(p75) & year==`y'
drop			if nsale>r(p25) & nsale<r(p75) & year==`y'
}
g				cutoff_09=cutoff*y09
g				cutoff_10=cutoff*y10
g				xtc_post=xtc*post
g				cutoff_xtc=cutoff*xtc
g				cutoff_xtc_09=cutoff*xtc*y09
g				cutoff_xtc_10=cutoff*xtc*y10
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10, cluster(regnor)
matrix			table[13,`j']=e(N)
matrix			table[13,`j'+1]=e(N)
matrix			table[`i',`j']=_b[cutoff_09]
matrix			table[`i'+1,`j']=_se[cutoff_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_10]
matrix			table[`i'+1,`j']=_se[cutoff_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_09]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_10]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc]
matrix			table[`i'+1,`j']=_se[cutoff_xtc]
local			i=`i'+2
matrix			table[`i',`j']=_b[xtc_post]
matrix			table[`i'+1,`j']=_se[xtc_post]
qui				sum logchange if post==0
matrix			table[14,`j']=r(mean)
matrix			table[14,`j'+1]=r(mean)
local			j=`j'+1

g				beta09_b=0
g				beta10_b=0
g				betaxtc09_b=0
g				betaxtc10_b=0
g				se09_b=0
g				se10_b=0
g				sextc09_b=0
g				sextc10_b=0
g				b_cutoff_xtc_b=0
g				se_cutoff_xtc_b=0
g				b_xtc_post_b=0
g				se_xtc_post_b=0
count			if xtc==1 & year==2009 
local			nxtc09=r(N)
count			if xtc==1 & year==2010 
local			nxtc10=r(N)
count			if xtc==1 & (year==2009 | year==2010) 
local			nxtc=r(N)
count			if xtc==0 & year==2009 
local			notxtc09=r(N)
count			if xtc==0 & year==2010 
local			notxtc10=r(N)
qui				count if xtc==1 & cutoff==1
local			ncutoffxtc=r(N)
forvalues		b=100(20)500 {
qui				count if xtc==1 & year==2009 & bin==`b'
local			nxtc09_b=r(N)
qui				count if xtc==1 & year==2010 & bin==`b'
local			nxtc10_b=r(N)
qui				count if xtc==1 & (year==2009 | year==2010) & bin==`b' 
local			nxtc_b=r(N)
qui				count if xtc==0 & year==2009 & bin==`b'
local			notxtc09_b=r(N)
qui				count if xtc==0 & year==2010 & bin==`b'
local			notxtc10_b=r(N)
qui				count if xtc==1 & cutoff==1 & bin==`b'
local			ncutoffxtc_b=r(N)
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10 if bin==`b', cluster(regnor)
replace			beta09_b=_b[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
replace			se09_b=_se[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
local			i=`i'+2
replace			beta10_b=_b[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
replace			se10_b=_se[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
local			i=`i'+2
replace			betaxtc09_b=_b[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
replace			sextc09_b=_se[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
local			i=`i'+2
replace			betaxtc10_b=_b[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
replace			sextc10_b=_se[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
local			i=`i'+2
replace			b_cutoff_xtc_b=_b[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			se_cutoff_xtc_b=_se[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			b_xtc_post_b=_b[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
replace			se_xtc_post_b=_se[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
}
local			i=1
duplicates  	drop bin, force
egen 			beta09=sum(beta09_b)
g				sse09_b=se09_b^2
egen			se09_s=sum(sse09_b)
g				se09=sqrt(se09_s)
egen 			beta10=sum(beta10_b)
g				sse10_b=se10_b^2
egen			se10_s=sum(sse10_b)
g				se10=sqrt(se10_s)
egen			betaxtc09=sum(betaxtc09_b)
g				ssextc09_b=sextc09_b^2
egen			sextc09_s=sum(ssextc09_b)
g				sextc09=sqrt(sextc09_s)
egen			betaxtc10=sum(betaxtc10_b)
g				ssextc10_b=sextc10_b^2
egen			sextc10_s=sum(ssextc10_b)
g				sextc10=sqrt(sextc10_s)
egen 			b_cutoff_xtc=sum(b_cutoff_xtc_b)
g				sse_cutoff_xtc_b=se_cutoff_xtc_b^2
egen			se_cutoff_xtc_s=sum(sse_cutoff_xtc_b)
g				se_cutoff_xtc=sqrt(se_cutoff_xtc_s)
egen			b_xtc_post=sum(b_xtc_post_b)
g				sse_xtc_post_b=se_xtc_post_b^2
egen			se_xtc_post_s=sum(sse_xtc_post_b)
g				se_xtc_post=sqrt(se_xtc_post_s)
qui				sum beta09
matrix			table[`i',`j']=r(mean)
qui				sum se09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum beta10
matrix			table[`i',`j']=r(mean)
qui				sum se10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc09
matrix			table[`i',`j']=r(mean)
qui				sum sextc09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc10
matrix			table[`i',`j']=r(mean)
qui				sum sextc10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_cutoff_xtc
matrix			table[`i',`j']=r(mean)
qui				sum se_cutoff_xtc
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_xtc_post
matrix			table[`i',`j']=r(mean)
qui				sum se_xtc_post
matrix			table[`i'+1,`j']=r(mean)
local 			j=`j'+1
restore

/* COLUMN (5)-(6) TOP DECILE - WITHOUT BASELINE INCOME CONTROL */

preserve
local			i=1
g				xtc=0
forvalues		y=2006/2011 {
qui				sum nsale if year==`y',d
replace			xtc=1 if nsale>r(p90) & year==`y'
drop			if nsale>r(p10) & nsale<r(p90) & year==`y'
}
g				cutoff_09=cutoff*y09
g				cutoff_10=cutoff*y10
g				xtc_post=xtc*post
g				cutoff_xtc=cutoff*xtc
g				cutoff_xtc_09=cutoff*xtc*y09
g				cutoff_xtc_10=cutoff*xtc*y10
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10, cluster(regnor)
matrix			table[13,`j']=e(N)
matrix			table[13,`j'+1]=e(N)
matrix			table[`i',`j']=_b[cutoff_09]
matrix			table[`i'+1,`j']=_se[cutoff_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_10]
matrix			table[`i'+1,`j']=_se[cutoff_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_09]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_09]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc_10]
matrix			table[`i'+1,`j']=_se[cutoff_xtc_10]
local			i=`i'+2
matrix			table[`i',`j']=_b[cutoff_xtc]
matrix			table[`i'+1,`j']=_se[cutoff_xtc]
local			i=`i'+2
matrix			table[`i',`j']=_b[xtc_post]
matrix			table[`i'+1,`j']=_se[xtc_post]
qui				sum logchange if post==0
matrix			table[14,`j']=r(mean)
matrix			table[14,`j'+1]=r(mean)
local			j=`j'+1

g				beta09_b=0
g				beta10_b=0
g				betaxtc09_b=0
g				betaxtc10_b=0
g				se09_b=0
g				se10_b=0
g				sextc09_b=0
g				sextc10_b=0
g				b_cutoff_xtc_b=0
g				se_cutoff_xtc_b=0
g				b_xtc_post_b=0
g				se_xtc_post_b=0
count			if xtc==1 & year==2009 
local			nxtc09=r(N)
count			if xtc==1 & year==2010 
local			nxtc10=r(N)
count			if xtc==1 & (year==2009 | year==2010) 
local			nxtc=r(N)
count			if xtc==0 & year==2009 
local			notxtc09=r(N)
count			if xtc==0 & year==2010 
local			notxtc10=r(N)
qui				count if xtc==1 & cutoff==1
local			ncutoffxtc=r(N)
forvalues		b=100(20)500 {
qui				count if xtc==1 & year==2009 & bin==`b'
local			nxtc09_b=r(N)
qui				count if xtc==1 & year==2010 & bin==`b'
local			nxtc10_b=r(N)
qui				count if xtc==1 & (year==2009 | year==2010) & bin==`b' 
local			nxtc_b=r(N)
qui				count if xtc==0 & year==2009 & bin==`b'
local			notxtc09_b=r(N)
qui				count if xtc==0 & year==2010 & bin==`b'
local			notxtc10_b=r(N)
qui				count if xtc==1 & cutoff==1 & bin==`b'
local			ncutoffxtc_b=r(N)
qui				reg logchange i.year cutoff xtc cutoff_09 cutoff_10 xtc_post cutoff_xtc cutoff_xtc_09 cutoff_xtc_10 if bin==`b', cluster(regnor)
replace			beta09_b=_b[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
replace			se09_b=_se[cutoff_09]*`notxtc09_b'/`notxtc09' if bin==`b'
local			i=`i'+2
replace			beta10_b=_b[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
replace			se10_b=_se[cutoff_10]*`notxtc10_b'/`notxtc10' if bin==`b'
local			i=`i'+2
replace			betaxtc09_b=_b[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
replace			sextc09_b=_se[cutoff_xtc_09]*`nxtc09_b'/`nxtc09' if bin==`b'
local			i=`i'+2
replace			betaxtc10_b=_b[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
replace			sextc10_b=_se[cutoff_xtc_10]*`nxtc10_b'/`nxtc10' if bin==`b'
local			i=`i'+2
replace			b_cutoff_xtc_b=_b[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			se_cutoff_xtc_b=_se[cutoff_xtc]*`ncutoffxtc_b'/`ncutoffxtc' if bin==`b'
replace			b_xtc_post_b=_b[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
replace			se_xtc_post_b=_se[xtc_post]*`nxtc_b'/`nxtc' if bin==`b'
}
local			i=1
duplicates  	drop bin, force
egen 			beta09=sum(beta09_b)
g				sse09_b=se09_b^2
egen			se09_s=sum(sse09_b)
g				se09=sqrt(se09_s)
egen 			beta10=sum(beta10_b)
g				sse10_b=se10_b^2
egen			se10_s=sum(sse10_b)
g				se10=sqrt(se10_s)
egen			betaxtc09=sum(betaxtc09_b)
g				ssextc09_b=sextc09_b^2
egen			sextc09_s=sum(ssextc09_b)
g				sextc09=sqrt(sextc09_s)
egen			betaxtc10=sum(betaxtc10_b)
g				ssextc10_b=sextc10_b^2
egen			sextc10_s=sum(ssextc10_b)
g				sextc10=sqrt(sextc10_s)
egen 			b_cutoff_xtc=sum(b_cutoff_xtc_b)
g				sse_cutoff_xtc_b=se_cutoff_xtc_b^2
egen			se_cutoff_xtc_s=sum(sse_cutoff_xtc_b)
g				se_cutoff_xtc=sqrt(se_cutoff_xtc_s)
egen			b_xtc_post=sum(b_xtc_post_b)
g				sse_xtc_post_b=se_xtc_post_b^2
egen			se_xtc_post_s=sum(sse_xtc_post_b)
g				se_xtc_post=sqrt(se_xtc_post_s)
qui				sum beta09
matrix			table[`i',`j']=r(mean)
qui				sum se09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum beta10
matrix			table[`i',`j']=r(mean)
qui				sum se10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc09
matrix			table[`i',`j']=r(mean)
qui				sum sextc09
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum betaxtc10
matrix			table[`i',`j']=r(mean)
qui				sum sextc10
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_cutoff_xtc
matrix			table[`i',`j']=r(mean)
qui				sum se_cutoff_xtc
matrix			table[`i'+1,`j']=r(mean)
local			i=`i'+2
qui				sum b_xtc_post
matrix			table[`i',`j']=r(mean)
qui				sum se_xtc_post
matrix			table[`i'+1,`j']=r(mean)
local 			j=`j'+1
restore

/* FORMATTING TABLE */

svmat 			table
keep			tab*
keep			if _n<=14
forvalues		c=1/6 {
				g c`c'=string(table`c',"%9.3f")
				replace c`c'=string(table`c',"%9.0fc") in 13
				forvalues		r=2(2)12 {
					replace c`c'="("+string(table`c',"%9.3f")+")" in `r'
				}
}
g				c9=""
replace			c9="$\mbox{\emph{to-zero}} \times 2009$" in 1
replace			c9="$\mbox{\emph{to-zero}} \times 2010$" in 3
replace			c9="$\mbox{\emph{to-zero}} \times \mbox{\emph{trait}} \times 2009$" in 5
replace			c9="$\mbox{\emph{to-zero}} \times \mbox{\emph{trait}} \times 2010$" in 7
replace			c9="$\mbox{\emph{to-zero}} \times \mbox{\emph{trait}}$" in 9
replace			c9="$\mbox{\emph{trait}} \times \mbox{\emph{post}}$" in 11
replace			c9="Observations" in 13
forvalues		s=1/8 {
g				s`s'="&"
}
g				l="\\"
replace 		l="\\\\\\" in 12
browse			c9 s1 c1 s2 c2 s3 c3 s4 c4 s5 c5 s6 c6 l
